The Robey data frame
library(ggplot2)
library(plotly)
require(car)
data(Robey, package = 'car')
## Warning in data(Robey, package = "car"): data set 'Robey' not found
g <- ggplot(data = Robey, aes(x = contraceptors, y = tfr)) +
geom_point(aes(text = paste('Country:', rownames(Robey)),
fill=region, size=2), colour="black", shape=21) +
ylab("Total fertility rate") +
xlab("% contraceptors among married women") +
theme(legend.title=element_blank())
## Warning: Ignoring unknown aesthetics: text
ggplotly(g, tooltip = c("text", "x", "y")) %>%
layout(title = 'Fertility and Contraception')